#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "Logger.h"
#include "logview.h"
#include <QDir>
#include <QDebug>
#include <QStackedWidget>
#include <QFileDialog>
#include "Logger.h"
#include "filecomparisondialog.h"
#include <QApplication>
#include <QTreeView>
#include <QFileSystemModel>
#include <QVBoxLayout>
#include <QWidget>
#include <QTextBrowser>
#include <QSet>
#include <settingsdialog.h>
#include "FileBackupThread.h"


QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_fileselect_up_clicked();

    void on_fileseclet1_clicked();

    void on_start_beifen_clicked();

    void on_toolButton_2_clicked();

    void on_toolButton_3_clicked();

    void on_fileselect_up_2_clicked();

    void performBackup(bool& iszl); // 添加这一行，声明 performBackup 函数

    void performBackup1();

    void on_progressBar_valueChanged(int value);

    int countFilesRecursively(const QDir& dir);

    void synchronizeDirectories(const QString &srcDir, const QString &destDir, int totalSteps, QSet<QString> &processedFiles);

    void performAutoBackup();

    void on_checkBox_stateChanged(int arg1);

    void on_pushButton_5_clicked();

    void on_progressBar_2_valueChanged(int value);

    void on_checkBox_2_stateChanged(int arg1);

    void showLogViewer();

    void openSettingsDialog();

    void backupLargeFile(const QString& sourcePath, const QString& destPath, bool iszl, int totalFiles);

private:
    Ui::MainWindow *ui;
    Logger *logger; // 声明 logger 变量
    LogViewer *logViewer; // 添加 LogViewer 成员变量
    int currentProgress = 0;
    int copiedFiles = 0;
    SettingsDialog *settingsDialog;
    QTimer *backupTimer;

};
#endif // MAINWINDOW_H
